<template>
  <div>
    <h3>学号姓名
    </h3>
    <button @click="add">请求数据</button>
  
    <!-- <table class="table table-bordered table-stripped table-hover ">
      <tbody>
        <tr v-for="item in obj.list" :key="item.aid">
    
     <td>{{ item.aid }}</td> <td>{{ item.catid }}</td>
     <td>{{item.username }}</td><td>{{ item.title }}</td>
     <td>{{ item.pic }}</td>
     <td><img :src="item.pic" alt=""></td><td>{{ item. dateline}}</td>
      </tr>
      </tbody>
    
    </table> -->
    <hr>
    {{ obj.list }}
  <hr>
  {{ array }}
  </div>
</template>

<script setup>
 import axios from 'axios';
 
 import {reactive,ref } from 'vue'

let array = ref([]);
let obj = reactive({
  list:[]
});
//const url='http://www.phonegap100.com/appapi.php?a=getPortalList&catid=20&page=1';
//const url='https://jsonplaceholder.typicode.com/posts';
const url='http://112.125.90.247:81/api/Data/GetAll';
// const add=()=>{
//   axios.get(url)
//   .then(res=>{
//             console.log(res)
//         })
//   .catch(
//           error=>{
//             console.log(error)
//       })
// }
const  add=()=>{
  axios.request({
    url,
    method:'get'
  }).then(res=>{
    console.log(res.data);
  }).catch(error=>{
       console.log(error)
  })
  //    axios.get(url).then(res=>{
  //       console.log(res.data);
  //       //obj.list=res.data;
  //       array.value = res.data;
  // }).catch(error=>{
  //       console.log(error)
  // })
}
</script>